<?php
/**
 * Created by PhpStorm
 * User: Jhinwy
 * Date: 6/7/24
 * Time: 5:01 PM
 */

namespace App\Http\Controllers\Admin;

use App\Services\BookRecordService;
use Illuminate\Http\Request;
use App\Http\Controllers\ResourceController;

class BookRecordController extends ResourceController
{
    protected $service;

    public function __construct(BookRecordService $service)
    {
        $this->service = $service;
    }


    /**
     * 书籍记录列表
     *
     * @param Request $request
     * @return mixed
     */
    public function getList(Request $request)
    {
        return $this->responseWithSuccess($this->service->getList($request->post()));
    }


    /**
     * 更新书籍记录
     *
     * @param Request $request
     * @return mixed
     */
    public function save(Request $request)
    {
        return $this->service->save($request->post()) ?
            $this->responseWithSuccess() : $this->responseWithError();
    }
}
